package com.ruoyi.web.wrapper;

import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.channel.enums.ChannelTypeEnum;
import com.ruoyi.channel.enums.PageTypeEnum;
import com.ruoyi.common.wrapper.BaseControllerWrapper;
import com.ruoyi.laiqianba.enums.ChargeTypeEnum;
import com.ruoyi.laiqianba.enums.FlowRateTypeEnum;

import java.util.List;
import java.util.Map;

public class ChannelBaseInfoWrapper extends BaseControllerWrapper {

    public ChannelBaseInfoWrapper(Map<String, Object> single) {
        super(single);
    }

    public ChannelBaseInfoWrapper(List<Map<String, Object>> multi) {
        super(multi);
    }

    @Override
    public void wrapTheMap(Map<String, Object> map) {

        try {

            String channelType = (String) map.get("channelType");
            if (ObjectUtil.isNotEmpty(channelType)){
                map.put("channelTypeStr", ChannelTypeEnum.getNameByValue(channelType));
            }

            String pageType = (String) map.get("pageType");
            if (ObjectUtil.isNotEmpty(pageType)){
                map.put("pageTypeStr", PageTypeEnum.getNameByValue(pageType));
            }

            String flowRateType = (String) map.get("flowRateType");
            if (ObjectUtil.isNotEmpty(flowRateType)){
                map.put("flowRateTypeStr", FlowRateTypeEnum.getNameByValue(flowRateType));
            }

            Integer chargeType = (Integer) map.get("chargeType");
            if (ObjectUtil.isNotEmpty(chargeType)){
                map.put("chargeTypeStr", ChargeTypeEnum.getNameByValue(chargeType));
            }

        }catch (Exception ex){
            ex.printStackTrace();
        }
    }
}
